package com.yunkaweilai.android.view.dialog.shop;

import android.content.Context;
import android.graphics.Color;
import android.text.Html;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.flyco.dialog.utils.CornerUtils;
import com.flyco.dialog.widget.base.BaseDialog;
import com.yunkaweilai.android.R;

/**
 * 条码存在提示
 * Created by Administrator on 2016/12/22 0022.
 */

public class ShopCodeSingleDialog extends BaseDialog<ShopCodeSingleDialog> {
    TextView idTvRight;
    ImageView idImgClose;
    private Context context;
    private TextView idTvContent;
    private String content;
    public ShopCodeSingleDialog(Context context,String content) {
        super(context);
        this.context = context;
        this.content = content;
    }

    @Override
    public View onCreateView() {
        widthScale(0);
        //showAnim(new Swing());
        //dismissAnim(this, new ZoomOutExit());
        View inflate = View.inflate(mContext, R.layout.dialog_code_single, null);
        idTvRight = (TextView) inflate.findViewById(R.id.id_tv_right);
        idImgClose = (ImageView) inflate.findViewById(R.id.id_img_close);
        idTvContent = ((TextView) inflate.findViewById(R.id.id_edt_type_name));
        idTvContent.setText(Html.fromHtml(content));
        //设置背景颜色，和背景的透明圆弧角度
        inflate.setBackgroundDrawable(
                CornerUtils.cornerDrawable(Color.parseColor("#f8f9fa"), dp2px(10)));

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        idImgClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        idTvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dismiss();
            }
        });
    }
}
